<?php

class StringLengthValidator
{
	public function StringLengthValidator($MinLength, $CanBeEmpty = false)
	{
		$this->MinLength = $MinLength;
		$this->CanBeEmpty = $CanBeEmpty;
	}
	public function Validate($Value)
	{
		if(!($this->CanBeEmpty && strlen($Value) < 1))
			if(strlen($Value) < $this->MinLength)
				return 'Must be at least ' . $this->MinLength . ' characters long.';
		return null;
	}
}